package com.lang.teacher.dao.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.asiainfo.crm.core.base.SqlmapBaseDao;
import com.asiainfo.crm.core.web.PageObject;
import com.lang.teacher.dao.TeacherDao;
import com.lang.teacher.model.Teacher;

public class TeacherDaoImp extends SqlmapBaseDao implements TeacherDao {

	public Teacher getTeacher(String teacherid) {
		Map condition = new HashMap();
		condition.put("teacherid",teacherid);
		return (Teacher) this.getSqlMapAsiainfoTemplate().queryForObject( "TEACHER.select", condition);
	}

	public List getTeachers(Map condition) {
		return this.getSqlMapAsiainfoTemplate().queryForList("TEACHER.select",condition);
	}

	public List getTeachers(PageObject po){
		po.setCountStatement("TEACHER.count");
		po.setSelectStatement("TEACHER.select");
		return getTeachers(po.getCondition());
	}

	public Integer count(Map condition) {
		return (Integer) this.getSqlMapAsiainfoTemplate().queryForObject("TEACHER.count", condition);
	}

	public void insertTeacher(Teacher obj) {
		this.getSqlMapAsiainfoTemplate().insert("TEACHER.insert", obj);
	}

	public void updateTeacher(Teacher obj) {
		this.getSqlMapAsiainfoTemplate().update("TEACHER.update", obj);
	}

	public void deleteTeachers(Map condition) {
		this.getSqlMapAsiainfoTemplate().delete("TEACHER.delete", condition);
	}
	public void insertTeacherHis(Map data) {
	this.getSqlMapAsiainfoTemplate().insert("TEACHER.insertHis", data);
	}


}
